package com.party.core.model.member;

import com.google.common.collect.Maps;

import java.util.Map;

/**
 * @Description: 会员管理类型
 * @Author: yangshoukun
 * @Date: 2018/2/22 18:12
 */
public enum MemberMgmtType {

    会员管理(0, "会员管理"), 用户管理(1, "用户管理");

    private Integer code;
    private String value;

    private MemberMgmtType(Integer code, String value) {
        this.code = code;
        this.value = value;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public static String getValue(Integer code) {
        MemberMgmtType[] enums = MemberMgmtType.values();
        for (MemberMgmtType e: enums) {
            if (e.getCode().equals(code)) {
                return e.getValue();
            }
        }
        return null;
    }

    public static Map<Integer, String> convertMap() {
        Map<Integer, String> map = Maps.newHashMap();
        MemberMgmtType[] enums = MemberMgmtType.values();
        for (MemberMgmtType e: enums) {
            map.put(e.getCode(), e.getValue());
        }
        return map;
    }

}
